package cate.game.play.skill.passive.god;

import cate.common.table.d.GDSkill;
import cate.game.play.base.TargetFilterParam;
import cate.game.play.base.TargetSelector;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.proce.action.ctx.TimeActionCtx;
import cate.game.play.proce.move.MoveCtx;
import cate.game.play.skill.passive.PassiveHandler;

/**
 * 使用治疗或增益类技能为至多2个目标附加【明镜】2回合
 */
public class 明镜止水PH extends PassiveHandler {

	private int 人数;

	private int buff;

	//人数=2&buff=？？
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		人数 = args.getInt("人数", 0);
		buff = args.getInt("buff", 0);
	}

	private boolean moveAdd;

	@Override
	public void onSkillDone(SkillActionCtx action) {
		if(moveAdd){
			return;
		}
		if(!action.getSkill().cfg.isSupportSkill()){
			return;
		}
		moveAdd = true;
		TargetFilterParam param = new TargetFilterParam().scopeSet(GDSkill.Scope.WE).targetNumSet(人数);
		for (Fighter target : TargetSelector.doFind(skill.owner, action.getTeamVs(), param)) {
			target.buff.tryAddByTid(action, skill.owner, buff);
		}
	}

	@Override
	public void onOwnerMoveDone(MoveCtx move, TimeActionCtx action) {
		moveAdd = false;
	}
}
